<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link rel="stylesheet" href="css/forms.css" type="text/css" />
    <link rel="stylesheet" href="css/toolbar.css" type="text/css" />
    <script type="text/javascript">
		function editarTransactionType(index, tamanioColeccion){
			if(tamanioColeccion > 1){
				transactionType[index].submit();
			}else{
				transactionType.submit();
			}		
		}
		function eliminarTransactionType(index, tamanioColeccion){
			if(tamanioColeccion > 1){
				deleteTransactionType[index].submit();
			}else{
				deleteTransactionType.submit();
			}		
		}
	</script>
    <title>TP Final: Tipo de Trámite</title>
</head>
<body>
	<!-- HEADER -->
    <div class="header">
        <nav>
            <ul>
                <li><a href="#">Herramientas</a>
                    <ul>
                        <li><a href="#">Buscar trámite</a></li>
                        <li><a href="#">Buscar cliente</a></li>
                        <li><a href="viewClients.do">Ver clientes</a></li>
                        <li><a href="#">Nuevo cliente</a></li>
                        <li><a href="viewTransactionType.do">Ver Tipos de Tramites</a></li>
                        <li><a href="transactionTypeSetUp.do">Nuevo Tipo de Tramite</a></li>
                        <li><a href="viewTransaction.do">Ver Tramite</a></li>
                        <li><a href="transactionSetUp.do">Nuevo Tramite</a></li>
                    </ul>
                </li>
                <li><a href="#">Salir</a></li>
            </ul>
        </nav>
    </div>
    <!-- MAIN BODY -->
    <div>
        <h2>Listado de Tipos de Trámite</h2>
        <logic:notEmpty name="errors">
	    	<h2 class="warningHeader">${errors}</h2>
	    </logic:notEmpty>
        <table style="width: 100%; margin: 0 auto 0 auto; border: 1px solid black;">
            <thead>
                <tr>
                    <th>Nombre</th>
                    <th>Requerimientos</th>
                    <th>Comentarios</th>
                    <th colspan="2">Modificar</th>
                </tr>
            </thead>
            <tbody>
				<bean:size id="tamanioColeccion" name="transactionTypeList" scope="request"/>
                <logic:iterate id="transactionType" name="transactionTypeList" indexId="i">
					<html:form action="/transactionTypeSetUp.do" method="post">
              			<html:hidden name="transactionType" property="oid"/>				
            		</html:form>
            		<html:form action="/transactionTypeSetUp2.do" method="post">
              			<html:hidden name="transactionType" property="oid"/>				
            		</html:form>
                   	<tr id="hoverRow">
                    	<td>${transactionType.name}</td>
                       	<td>${transactionType.requirements}</td>
                       	<td>${transactionType.comments}</td>
                       	<td><a href="#" onclick="editarTransactionType(${i}, ${tamanioColeccion});">Editar</a></td>
                       	<td><a href="#" onclick="eliminarTransactionType(${i}, ${tamanioColeccion});">Eliminar</a></td>
                   	</tr>
                </logic:iterate>
            </tbody>
        </table>
    </div>
    <!-- FOOTER -->
</body>
</html>